package com.holly.unit.bpmn.starter;

import com.holly.unit.bpmn.activiti.ActivitiOperator;
import com.holly.unit.bpmn.api.WorkflowApi;
import com.holly.unit.bpmn.designer.core.facade.BpmnDesignerFacadeApi;
import com.holly.unit.bpmn.designer.core.facade.BpmnDesignerFacadeApiImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 类描述: 工作流自动配置
 *
 * @author fxr
 * @version 1.0.0
 * @date 2022/3/10 10:09
 */
@Configuration
public class BpmnAutoConfiguration {

    /**
     * 接口规范
     *
     * @author holly
     * @date 2020/12/1 14:40
     */
    @Bean
    @ConditionalOnMissingBean(WorkflowApi.class)
    public WorkflowApi workflowApi() {
        return new ActivitiOperator();
    }

    /***
     * Activiti版本
     * @return
     */
    @Bean
    @ConditionalOnMissingBean(ActivitiOperator.class)
    public ActivitiOperator operator() {
        return new ActivitiOperator();
    }

    /***
     * 流程设计器
     * @return
     */
    @Bean
    @ConditionalOnMissingBean(BpmnDesignerFacadeApi.class)
    public BpmnDesignerFacadeApi bpmnDesignerFacadeApi() {
        return new BpmnDesignerFacadeApiImpl();
    }

}
